﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HPIT.RentHouse.Common;
using HPIT.RentHouse.DTO;
using HPIT.RentHouse.IService;
using HPIT.RentHouse.Service.Entities;

namespace HPIT.RentHouse.Service
{
    public class IdNameService : IIdNameService
    {
        /// <summary>
        /// 根据类型名获取数据字典集合
        /// </summary>
        /// <param name="typeName"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public List<IdNameDTO> GetIdNameList(IdNameEnum typeName)
        {
            var db = new RentEntity();
            var bs = new BaseService<T_IdNames>(db);
            //根据类别名称查询出对应的类别
            var list = bs.GetList(a => a.TypeName==typeName.ToString()).Select(a => new IdNameDTO
            {
                Id = a.Id,
                TypeName = a.TypeName,
                Name = a.Name
            }).ToList();            
            return list;
        }

        /// <summary>
        /// 根据Id获取对应的名字
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public string GetName(long id)
        {
            throw new NotImplementedException();
        }
    }
}
